<?php

	$captcha = isset($_REQUEST['code']) ? $_REQUEST['code'] : '';
	$code_success = isset($_COOKIE['security_code']) ? $_COOKIE['security_code'] : '';
	
	if ($captcha && $code_success) {
		if(md5(mb_strtolower($captcha)) == $code_success) {
			$message = '<h3 style="color: green;">Введено верно</h3>';
		} else {
			$message = '<h3 style="color: red;">Введено не верно</h3>';
		}
	}

?><!DOCTYPE html>
<html lang="ru">
<head>
	<meta charset="UTF-8">
	<title>Проверка каптчи</title>
</head>
<body>
	<h1>Проверка каптчи</h1>
	<?php print $message ? $message : ''; ?>
	<form action="" method="post">
		<img src="index.php" alt=""><br>
		<input type="text" value="" name="code" placeholder="Введите текст с картинки">
		<input type="submit" value="Проверить">
	</form>
</body>
</html>